﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Shapes;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows;

using Fennec;

namespace IHM.ClassesFonction
{
    public class ConstructeurGraphique
    {
        FenetreJeu fenetre;

        public ConstructeurGraphique(FenetreJeu f)
        {
            fenetre = f;
        }

        // Fonction qui créé un rectangle de type unité
        public TextBlock creerTextBlockUnite(int c1, int c2, EElement element)
        {
            TextBlock tb = new TextBlock();

            Grid.SetColumn(tb, c1);
            Grid.SetRow(tb, c2);

            switch (element)
            {
                case EElement.EL_ET:
                    tb.Text = "0";
                    tb.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                    tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                    tb.Margin = new System.Windows.Thickness(0, 2, 2, 0);
                    break;
                case EElement.EL_ENS:
                    tb.Text = "0";
                    tb.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
                    tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                    tb.Margin = new System.Windows.Thickness(0, 0, 2, 2);
                    break;
                case EElement.EL_DIR:
                    tb.Text = "Dir";
                    tb.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
                    tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    tb.Margin = new System.Windows.Thickness(2, 0, 0, 2);
                    break;
            }

            tb.TextAlignment = TextAlignment.Center;
            tb.FontSize = 12;

            return tb;
        }
        
        // Fonction qui créé une ellipse
        public Ellipse creerEllipseVille(int c1, int c2)
        {
            Ellipse e = new Ellipse();

            Grid.SetColumn(e, c1);
            Grid.SetRow(e, c2);

            e.Stroke = Brushes.Black;

            e.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            e.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            e.Margin = new System.Windows.Thickness(5, 5, 0, 0);
            e.Width = 20;
            e.Height = 20;

            return e;
        }
    }
}
